package com.service.gmall.product.api;

import com.service.gmall.common.result.Result;
import com.service.gmall.model.to.CategoryTreeTo;
import com.service.gmall.product.service.BaseCategory2Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author alpha
 * @className: CategoryApiController
 * @date 2022/8/26 10:27
 * @Description
 */
@Api(tags = "三级分类树结构查询")
@RequestMapping("/api/inner/rpc/product")
@RestController
public class CategoryApiController {
    @Autowired
    BaseCategory2Service baseCategory2Service;

    /**
     * @param
     * @description: 查询前端三级分类树形结构
     * @return: com.service.gmall.common.result.Result
     * @author: alpha
     * @date: 2022/8/26 10:32
     */
    @ApiOperation( "查询前端三级分类树形结构")
    @GetMapping("/category/tree")
    public Result getAllCategoryTree() {
        //创建三级分类Javabean
        // 查询三级菜单树
        List<CategoryTreeTo> categoryTreeTos =baseCategory2Service.getAllCategoryTree();
        return Result.ok(categoryTreeTos);
    }
}
